//应力
yingliOption = {
    tooltip: {
        trigger: 'axis'
    },
    legend: {
        data:['最大值','平均值','最小值']
    },
    toolbox: {
        show:false
    },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ['周一','周二','周三','周四','周五','周六','周日']
    },
    yAxis: {
        type: 'value',
        name:'应力',
        axisLabel: {
            formatter: '{value} MPa'
        }
    },
    series: [
        {
            name:'最大值',
            type:'line',
            data:[0.2, 0.44,0.55,0.67, 0.70, 0.76,0.79]
        },
        {
            name:'平均值',
            type:'line',
            data:[0.30, 0.35,0.50,0.54, 0.61, 0.70,0.72]
        },
        {
            name:'最小值',
            type:'line',
            data:[0.23, 0.30,0.44,0.50, 0.51, 0.63,0.66]
        }
    ]
};
tempOption = {
    tooltip: {
        trigger: 'axis'
    },
    legend: {
        data:['最大值','平均值','最小值']
    },
    toolbox: {
        show:false
    },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ['周一','周二','周三','周四','周五','周六','周日']
    },
    yAxis: {
        type: 'value',
        name:'温度',
        axisLabel: {
            formatter: '{value} °C'
        }
    },
    series: [
        {
            name:'最大值',
            type:'line',
            data:[5.2, 6.0,7.0,8.4, 8.5, 9.0,12.0]
        },
        {
            name:'平均值',
            type:'line',
            data:[4.4, 4.5,6.0,7.4, 8.0, 7.8,11.1]
        },
        {
            name:'最小值',
            type:'line',
            data:[4.0, 3.8,5.5,6.7, 7.0, 6.7,9.9]
        }
    ]
};
rawOption = {
    tooltip: {
        trigger: 'axis'
    },
    legend: {
        data:['最大值','平均值','最小值']
    },
    toolbox: {
        show:false
    },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ['周一','周二','周三','周四','周五','周六','周日']
    },
    yAxis: {
        type: 'value',
        name:'厚度',
        axisLabel: {
            formatter: '{value} μm'
        }
    },
    series: [
        {
            name:'最大值',
            type:'line',
            data:[8.5, 9.0,12.0,5.2, 6.0,7.0,8.4]
        },
        {
            name:'平均值',
            type:'line',
            data:[8.0, 7.8,11.1,4.4, 4.5,6.0,7.4]
        },
        {
            name:'最小值',
            type:'line',
            data:[7.0, 6.7,9.9,4.0, 3.8,5.5,6.7]
        }
    ]
};
//分型

var builderJson = {
    "all": 10887,
    "charts": {
        "≤10t": 3004,
        "(10,20]": 300,
        "(20,30]": 100,
        "(30,40]": 93,
        "(40,55]": 76,
        "≥55t": 20
    },
    "components": {
        "≤5t": 2948,
        "(5,10]": 473,
        "(10,14]": 172,
        "(14,20]": 106,
        "(20,30]": 13,
        "≥30t": 2
    },
    "ie": 9743
};

var downloadJson = {
    "2轴": 17365,
    "3轴": 4079,
    "4轴": 6929,
    "5轴": 1489,
    "6轴及以上":90
};

var themeJson = {
    "车道1": 1594,
    "车道2": 925,
    "车道3": 1608
};

var canvas = document.createElement('canvas');

fenxingOption = {
    tooltip: {},
    title: [{
        text: '总重/最大轴重',
        x: '25%',
        textAlign: 'center'
    },{
        text: '车型',
        x: '75%',
        textAlign: 'center'
    }, {
        text: '车道',
        x: '75%',
        y: '50%',
        textAlign: 'center'
    }],
    grid: [{
        top: 50,
        width: '50%',
        bottom: '45%',
        left: 10,
        containLabel: true
    }, {
        top: '55%',
        width: '50%',
        bottom: 0,
        left: 10,
        containLabel: true
    }],
    xAxis: [{
        type: 'value',
        max: builderJson.all,
        splitLine: {
            show: false
        }
    }, {
        type: 'value',
        max: builderJson.all,
        gridIndex: 1,
        splitLine: {
            show: false
        }
    }],
    yAxis: [{
        type: 'category',
        data: Object.keys(builderJson.charts),
        axisLabel: {
            interval: 0,
            rotate: 30
        },
        splitLine: {
            show: false
        }
    }, {
        gridIndex: 1,
        type: 'category',
        data: Object.keys(builderJson.components),
        axisLabel: {
            interval: 0,
            rotate: 30
        },
        splitLine: {
            show: false
        }
    }],
    series: [{
        type: 'bar',
        stack: 'chart',
        z: 3,
        label: {
            normal: {
                position: 'right',
                show: true
            }
        },
        data: Object.keys(builderJson.charts).map(function (key) {
            return builderJson.charts[key];
        })
    }, {
        type: 'bar',
        stack: 'chart',
        silent: true,
        itemStyle: {
            normal: {
                color: '#eee'
            }
        },
        data: Object.keys(builderJson.charts).map(function (key) {
            return builderJson.all - builderJson.charts[key];
        })
    }, {
        type: 'bar',
        stack: 'component',
        xAxisIndex: 1,
        yAxisIndex: 1,
        z: 3,
        label: {
            normal: {
                position: 'right',
                show: true
            }
        },
        data: Object.keys(builderJson.components).map(function (key) {
            return builderJson.components[key];
        })
    }, {
        type: 'bar',
        stack: 'component',
        silent: true,
        xAxisIndex: 1,
        yAxisIndex: 1,
        itemStyle: {
            normal: {
                color: '#eee'
            }
        },
        data: Object.keys(builderJson.components).map(function (key) {
            return builderJson.all - builderJson.components[key];
        })
    }, {
        type: 'pie',
        radius: [0, '30%'],
        center: ['75%', '25%'],
        data: Object.keys(downloadJson).map(function (key) {
            return {
                name: key.replace('.js', ''),
                value: downloadJson[key]
            }
        })
    }, {
        type: 'pie',
        radius: [0, '30%'],
        center: ['75%', '75%'],
        data: Object.keys(themeJson).map(function (key) {
            return {
                name: key.replace('.js', ''),
                value: themeJson[key]
            }
        })
    }]
}

///超限率

var downloadJson2 = {
    "总重超100%": 2,
    "总重超30%": 40,
    "总重超50%": 10
};

var themeJson2 = {
    "总重超50t": 20,
    "总重超55t": 15,
    "总重超60t": 10,
    "总重超70t": 4,
    "总重超80t": 3,
    "总重超90t": 2,
    "总重超100t": 1
};
chaoxianlvOption = {
    tooltip: {},
    title: [ {
        text: '',
        x: '25%',
        textAlign: 'center'
    }, {
        text: '',
        x: '75%',
        textAlign: 'center'
    }],
    series: [{
        type: 'pie',
        radius: [0, '30%'],
        center: ['25%', '50%'],
        data: Object.keys(downloadJson2).map(function (key) {
            return {
                name: key.replace('.js', ''),
                value: downloadJson2[key]
            }
        })
    }, {
        type: 'pie',
        radius: [0, '30%'],
        center: ['75%', '50%'],
        data: Object.keys(themeJson2).map(function (key) {
            return {
                name: key.replace('.js', ''),
                value: themeJson2[key]
            }
        })
    }]
}
//时间趋势
timequshiOption = {
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'cross',
            crossStyle: {
                color: '#999'
            }
        }
    },
    legend: {
        data:['车重','趋势']
    },
    xAxis: [
        {
            type: 'category',
            data: ['3-1','3-2','3-3','3-4','3-5','3-6','3-7','3-8','3-9','3-10'],
            axisPointer: {
                type: 'shadow'
            }
        }
    ],
    yAxis: [
        {
            type: 'value',
            name: '车重',
            min: 0,
            max: 50,
            axisLabel: {
                formatter: '{value} t'
            }
        },
        {
            type: 'value',
            name: '趋势',
            min: 0,
            max: 50,
            axisLabel: {
                formatter: '{value} t'
            }
        }
    ],
    series: [
        {
            name:'车重',
            type:'bar',
            data:[12.0, 12.9, 10.0, 12.2, 11.6, 10.7, 13.6, 16.2, 12.6, 13.0]
        },
        {
            name:'趋势',
            type:'line',
            yAxisIndex: 1,
            data:[12.0, 14.9, 11.0, 12.2, 11.6, 10.7, 13.6, 16.2, 12.6, 13.0]
        }
    ]
};
